<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    常用的键盘事件：
    keyup:事件在按键被松开时触发。
    keydown:事件在被按键按下时触发
    <script>
        document.addEventListener("keyup", function (e) {
            console.log("按键被松开时触发");
        })
        document.addEventListener("keydown", function (e) {
            console.log("按键被按下时触发");
        })
    </script>
</body>

</html>